#include <cstdint>
#include <iostream>
#include <vector>
using ll = int64_t;

#define il static inline

ll n,ans=0;

il ll geth(ll n){
    while(!(0<=n&&n<=9)){
        n/=10;
    }
    return n;
}

il ll getl(ll n){
    return n%10;
}

std::vector<std::vector<ll>> num;

int main(){
    std::cin>>n;
    num.resize(10,std::vector<ll>(10,0));
    for(ll i=1;i<=n;i++){
        num[geth(i)][getl(i)]++;
    }
    for(ll i=1;i<=9;i++){
        for(ll j=1;j<=9;j++){
            ans+=num[i][j]*num[j][i];
        }
    }
    std::cout<<ans<<'\n';
}